from jinja2 import Template, Environment, PackageLoader, FileSystemLoader

import os

from config import BaseConfig

template_path = "./templates"

# env = Environment(loader=FileSystemLoader(os.path.dirname(template_path)),
#                   keep_trailing_newline=True)
env = Environment(loader=FileSystemLoader(
    searchpath=BaseConfig.WS_AGENT_JSX_TEMPLATE_PATH),
    keep_trailing_newline=True)

attributes = {"k1": "v1", "k2": "v2"}

content = "hello"

data = {"tag_name": "mytag", "attributes": attributes, "content": content}

output = env.get_template("tag.jinja2").render(data)

output = output.encode('utf-8')

print output
